package com.sport.result;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;

/**
 * 后端统一返回结果
 * @param
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result  implements Serializable {

    private Integer code;
    private String msg;
    private String data;

    public static  Result success() {
        Result result = new Result();
        result.code = 200;
        result.msg = "success";
        return result;
    }

    public static  Result success(String object) {
        Result result = new Result();
        result.data = object;
        result.msg = "success";
        result.code = 200;
        return result;
    }
    public static  Result success(String object,int code) {
        Result result = new Result();
        result.data = object;
        result.msg = "success";
        result.code = code;
        return result;
    }

    public static  Result error(String msg) {
        Result result = new Result();
        result.msg = msg;
        result.code = 500;
        return result;
    }
    public static Result tokenError(int code,String msg,String data){
        return new Result(code,msg,data);
    }
    public static Result RoomDestroy(String msg,String data){
        return new Result(201,msg,data);
    }
    public static Result KillUser(String msg, String data) {
        return new Result(202,msg,data);
    }

}
